import { useWeather } from "@/api";
import { useSearchParams } from "next/navigation";



export default function Detail() {
  
  const searchParams = useSearchParams();
  const city = searchParams.get("city") || "北京";
  const { data: { data } = {} } = useWeather({ city });

  return (
    <div className="shadow-lg p-4 rounded-lg">
      <div className="text-xl font-bold">{data?.city}</div>
      <div>天气：{data?.weather}</div>
      <div>
        风向：{data?.wind}，{data?.windSpeed}
      </div>
      <div>生活：{data?.living[0].tips}</div>
    </div>
  );
}
